MySQL WHERE Clause
MySQL WHERE Clause is used with SELECT, INSERT, UPDATE and DELETE clause to filter the results. It specifies a specific position where you have to do the operation.
Syntax
Example
MySQL WHERE Clause is used with SELECT, INSERT, UPDATE and DELETE clause to filter the results. It specifies a specific position where you have to do the operation.
MySQL DISTINCT clause is used to remove duplicate records from the table and fetch only the unique records. The DISTINCT clause is only used with the SELECT statement.
The Order By Keyword Is Used To Sort The Result-Set In Ascending Or Descending Order. The Order By Keyword Sorts The Records In Ascending Order By Default. To Sort The Records In Descending Order, Use The Desc Keyword.
SELECT column1, column2, ... FROM table_name ORDER BY column1, column2, ... ASC|DESC;
The GROUP BY statement groups rows that have the same values into summary rows, like "find the number of customers in each country". The GROUP BY statement is often used with aggregate functions (COUNT(), MAX(), MIN(), SUM(), AVG()) to group the result-set by one or more columns.
HAVING clause was added to SQL because the WHERE keyword cannot be used with aggregate functions.
SELECT column_name(s) FROM table_name WHERE condition GROUP BY column_name(s) HAVING condition ORDER BY column_name(s);